home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / System / XADmaster / xad_dev / Include / C / libraries / xadmaster.h
Encoding:
C/C++ Source or Header  |  2001-04-01  |  31.9 KB  |  725 lines

  1. #ifndef LIBRARIES_XADMASTER_H
  2. #define LIBRARIES_XADMASTER_H
  3.  
  4. /*
  5. **    $VER: xadmaster.h 10.0 (22.03.2001)
  6. **    xadmaster.library defines and structures
  7. **
  8. **    Copyright © 1998-2001 by Dirk Stöcker
  9. **    All Rights Reserved.
  10. */
  11.  
  12. #ifndef EXEC_LIBRARIES_H
  13. #include <exec/libraries.h>
  14. #endif
  15.  
  16. #ifndef UTILITY_TAGITEM_H
  17. #include <utility/tagitem.h>
  18. #endif
  19.  
  20. #define     XADNAME  "xadmaster.library"
  21.  
  22. /* NOTE: Nearly all structures need to be allocated using the
  23.    xadAllocObject function. */
  24.  
  25. /************************************************************************
  26. *                                                *
  27. *    library base structure                        *
  28. *                                                *
  29. ************************************************************************/
  30.  
  31. struct xadMasterBase {
  32.   struct Library       xmb_LibNode;
  33.   struct ExecBase *    xmb_SysBase;
  34.   struct DosLibrary *  xmb_DOSBase;
  35.   struct UtilityBase * xmb_UtilityBase;
  36.   ULONG               xmb_RecogSize;    /* read only */
  37.   STRPTR           xmb_DefaultName; /* name for XADFIF_NOFILENAME (V6) */
  38. };
  39.  
  40. /************************************************************************
  41. *                                                *
  42. *    tag-function call flags                               *
  43. *                                                *
  44. ************************************************************************/
  45.  
  46. /* input tags for xadGetInfo, only one can be specified per call */
  47. #define XAD_INSIZE        (TAG_USER+  1) /* input data size */
  48. #define XAD_INFILENAME        (TAG_USER+  2)
  49. #define XAD_INFILEHANDLE    (TAG_USER+  3)
  50. #define XAD_INMEMORY        (TAG_USER+  4)
  51. #define XAD_INHOOK        (TAG_USER+  5)
  52. #define XAD_INSPLITTED        (TAG_USER+  6) /* (V2) */
  53. #define XAD_INDISKARCHIVE    (TAG_USER+  7) /* (V4) */
  54. #define XAD_INXADSTREAM        (TAG_USER+  8) /* (V8) */
  55.  
  56. /* output tags, only one can be specified per call, xadXXXXUnArc */
  57. #define XAD_OUTSIZE        (TAG_USER+ 10) /* output data size */
  58. #define XAD_OUTFILENAME        (TAG_USER+ 11)
  59. #define XAD_OUTFILEHANDLE    (TAG_USER+ 12)
  60. #define XAD_OUTMEMORY        (TAG_USER+ 13)
  61. #define XAD_OUTHOOK        (TAG_USER+ 14)
  62. #define XAD_OUTDEVICE        (TAG_USER+ 15) /* for disk archives only */
  63. #define XAD_OUTXADSTREAM    (TAG_USER+ 16) /* (V8) */
  64.  
  65. /* object allocation tags for xadAllocObjectA */
  66. #define XAD_OBJNAMESIZE        (TAG_USER+ 20) /* XADOBJ_FILEINFO, size of needed name space */
  67. #define XAD_OBJCOMMENTSIZE    (TAG_USER+ 21) /* XADOBJ_FILEINFO, size of needed comment space */
  68. #define XAD_OBJPRIVINFOSIZE    (TAG_USER+ 22) /* XADOBJ_FILEINFO & XADOBJ_DISKINFO, self use size */
  69. #define XAD_OBJBLOCKENTRIES    (TAG_USER+ 23) /* XADOBJ_DISKINFO, number of needed entries */
  70.  
  71. /* tags for xadGetInfo, xadFileUnArc and xadDiskUnArc */
  72. #define XAD_NOEXTERN        (TAG_USER+ 50) /* do not use extern clients */
  73. #define XAD_PASSWORD        (TAG_USER+ 51) /* password when needed */
  74. #define XAD_ENTRYNUMBER        (TAG_USER+ 52) /* number of wanted entry */
  75. #define XAD_PROGRESSHOOK    (TAG_USER+ 53) /* the progress hook */
  76. #define XAD_OVERWRITE        (TAG_USER+ 54) /* overwrite file ? */
  77. #define XAD_MAKEDIRECTORY    (TAG_USER+ 55) /* create directory tree */
  78. #define XAD_IGNOREGEOMETRY    (TAG_USER+ 56) /* ignore drive geometry ? */
  79. #define XAD_LOWCYLINDER        (TAG_USER+ 57) /* lowest cylinder */
  80. #define XAD_HIGHCYLINDER    (TAG_USER+ 58) /* highest cylinder */
  81. #define XAD_VERIFY        (TAG_USER+ 59) /* verify for disk hook */
  82. #define XAD_NOKILLPARTIAL    (TAG_USER+ 60) /* do not delete partial/corrupt files (V3.3) */
  83. #define XAD_FORMAT        (TAG_USER+ 61) /* format output device (V5) */
  84. #define XAD_USESECTORLABELS    (TAG_USER+ 62) /* sector labels are stored on disk (V9) */
  85.  
  86. /* input tags for xadConvertDates, only one can be passed */
  87. #define XAD_DATEUNIX        (TAG_USER+ 70) /* unix date variable */
  88. #define XAD_DATEAMIGA        (TAG_USER+ 71) /* amiga date variable */
  89. #define XAD_DATEDATESTAMP    (TAG_USER+ 72) /* struct DateStamp */
  90. #define XAD_DATEXADDATE        (TAG_USER+ 73) /* struct xadDate */
  91. #define XAD_DATECLOCKDATA    (TAG_USER+ 74) /* struct ClockData */
  92. #define XAD_DATECURRENTTIME    (TAG_USER+ 75) /* input is system time */
  93. #define XAD_DATEMSDOS        (TAG_USER+ 76) /* MS-DOS packed format (V2) */
  94. #define XAD_DATEMAC        (TAG_USER+ 77) /* Mac date variable (V8) */
  95. #define XAD_DATECPM             (TAG_USER+ 78) /* CP/M data structure (V10) */
  96. #define XAD_DATECPM2            (TAG_USER+ 79) /* CP/M data structure type 2 (V10) */
  97.  
  98. /* output tags, there can be specified multiple tags for one call */
  99. #define XAD_GETDATEUNIX        (TAG_USER+ 80) /* unix date variable */
  100. #define XAD_GETDATEAMIGA    (TAG_USER+ 81) /* amiga date variable */
  101. #define XAD_GETDATEDATESTAMP    (TAG_USER+ 82) /* struct DateStamp */
  102. #define XAD_GETDATEXADDATE    (TAG_USER+ 83) /* struct xadDate */
  103. #define XAD_GETDATECLOCKDATA    (TAG_USER+ 84) /* struct ClockData */
  104. #define XAD_GETDATEMSDOS    (TAG_USER+ 86) /* MS-DOS packed format (V2) */
  105. #define XAD_GETDATEMAC        (TAG_USER+ 87) /* Mac date variable (V8) */
  106. #define XAD_GETDATECPM          (TAG_USER+ 88) /* CP/M data structure (V10) */
  107. #define XAD_GETDATECPM2         (TAG_USER+ 89) /* CP/M data structure type 2 (V10) */
  108.  
  109. /* following tags need locale.library to be installed */
  110. #define XAD_MAKEGMTDATE        (TAG_USER+ 90) /* make local to GMT time */
  111. #define XAD_MAKELOCALDATE    (TAG_USER+ 91) /* make GMT to local time */
  112.  
  113. /* tags for xadHookTagAccess (V3) */
  114. #define XAD_USESKIPINFO        (TAG_USER+104) /* the hook uses xadSkipInfo (V3) */
  115. #define XAD_SECTORLABELS    (TAG_USER+105) /* pass sector labels with XADAC_WRITE (V9) */
  116.  
  117. #define XAD_GETCRC16        (TAG_USER+120) /* pointer to UWORD value (V3) */
  118. #define XAD_GETCRC32        (TAG_USER+121) /* pointer to ULONG value (V3) */
  119.  
  120. #define XAD_CRC16ID        (TAG_USER+130) /* ID for crc calculation (V3) */
  121. #define XAD_CRC32ID        (TAG_USER+131) /* ID for crc calculation (V3) */
  122.  
  123. /* tags for xadConvertProtection (V4) */
  124. #define XAD_PROTAMIGA        (TAG_USER+160) /* Amiga type protection bits (V4) */
  125. #define XAD_PROTUNIX        (TAG_USER+161) /* protection bits in UNIX mode (V4) */
  126. #define XAD_PROTMSDOS        (TAG_USER+162) /* MSDOS type protection bits (V4) */
  127.  
  128. #define XAD_GETPROTAMIGA    (TAG_USER+170) /* return Amiga protection bits (V4) */
  129.  
  130. /* tags for xadGetDiskInfo (V7) */
  131. #define XAD_STARTCLIENT        (TAG_USER+180) /* the client to start with (V7) */
  132. #define XAD_NOEMPTYERROR    (TAG_USER+181) /* do not create XADERR_EMPTY (V8) */
  133.  
  134. /* tags for xadFreeHookAccess (V8) */
  135. #define XAD_WASERROR        (TAG_USER+190) /* error occured, call abort method (V8) */
  136.  
  137. /* tags for miscellaneous stuff */
  138. #define XAD_ARCHIVEINFO        (TAG_USER+200) /* xadArchiveInfo for stream hooks (V8) */
  139.  
  140. /* tags for xadAddFileEntry and xadAddDiskEntry (V10) */
  141. #define XAD_SETINPOS            (TAG_USER+240) /* set xai_InPos after call (V10) */
  142. #define XAD_INSERTDIRSFIRST     (TAG_USER+241) /* insert dirs at list start (V10) */
  143.  
  144. /************************************************************************
  145. *                                                *
  146. *    objects for xadAllocObjectA                           *
  147. *                                                *
  148. ************************************************************************/
  149.  
  150. #define XADOBJ_ARCHIVEINFO    0x0001 /* struct xadArchiveInfo */
  151. #define XADOBJ_FILEINFO        0x0002 /* struct xadFileInfo */
  152. #define XADOBJ_DISKINFO        0x0003 /* struct xadDiskInfo */
  153. #define XADOBJ_HOOKPARAM    0x0004 /* struct HookParam */
  154. #define XADOBJ_DEVICEINFO    0x0005 /* struct xadDeviceInfo */
  155. #define XADOBJ_PROGRESSINFO    0x0006 /* struct xadProgressInfo */
  156. #define XADOBJ_TEXTINFO        0x0007 /* struct xadTextInfo */
  157. #define XADOBJ_SPLITFILE    0x0008 /* struct xadSplitFile (V2) */
  158. #define XADOBJ_SKIPINFO        0x0009 /* struct xadSkipInfo (V3) */
  159. #define XADOBJ_IMAGEINFO    0x000A /* struct xadImageInfo (V4) */
  160.  
  161. /* result type of xadAllocVec */
  162. #define XADOBJ_MEMBLOCK        0x0100 /* memory of requested size and type */
  163.  
  164. /************************************************************************
  165. *                                                *
  166. *    modes for xadCalcCRC126 and xadCalcCRC32                *
  167. *                                                *
  168. ************************************************************************/
  169.  
  170. #define XADCRC16_ID1        0xA001
  171. #define XADCRC32_ID1        0xEDB88320
  172.  
  173. /************************************************************************
  174. *                                                *
  175. *    hook related stuff                                *
  176. *                                                *
  177. ************************************************************************/
  178.  
  179. #define XADHC_READ    1    /* read data into buffer */
  180. #define XADHC_WRITE    2    /* write buffer data to file/memory */
  181. #define XADHC_SEEK    3    /* seek in file */
  182. #define XADHC_INIT    4    /* initialize the hook */
  183. #define XADHC_FREE    5    /* end up hook work, free stuff */
  184. #define XADHC_ABORT    6    /* an error occured, delete partial stuff */
  185. #define XADHC_FULLSIZE    7    /* complete input size is needed */
  186. #define XADHC_IMAGEINFO    8    /* return disk image info (V4) */
  187.  
  188. struct xadHookParam {
  189.   ULONG xhp_Command;
  190.   LONG  xhp_CommandData;
  191.   APTR  xhp_BufferPtr;
  192.   ULONG xhp_BufferSize;
  193.   ULONG xhp_DataPos;        /* current seek position */
  194.   APTR  xhp_PrivatePtr;
  195.   APTR  xhp_TagList;        /* allows to transport tags to hook (V9) */
  196. };
  197.  
  198. /* xadHookAccess commands */
  199. #define XADAC_READ        10    /* get data */
  200. #define    XADAC_WRITE        11    /* write data */
  201. #define XADAC_COPY        12    /* copy input to output */
  202. #define XADAC_INPUTSEEK        13    /* seek in input file */
  203. #define XADAC_OUTPUTSEEK    14    /* seek in output file */
  204.  
  205. /************************************************************************
  206. *                                                *
  207. *    support structures                              *
  208. *                                                *
  209. ************************************************************************/
  210.  
  211. /* Own date structure to cover all possible dates in a human friendly
  212.    format. xadConvertDates may be used to convert between different date
  213.    structures and variables. */
  214. struct xadDate {
  215.   ULONG xd_Micros;    /* values 0 to 999999     */
  216.   LONG  xd_Year;    /* values 1 to 2147483648 */
  217.   UBYTE xd_Month;    /* values 1 to 12         */
  218.   UBYTE xd_WeekDay;    /* values 1 to 7          */
  219.   UBYTE xd_Day;        /* values 1 to 31         */
  220.   UBYTE xd_Hour;    /* values 0 to 23         */
  221.   UBYTE xd_Minute;    /* values 0 to 59         */
  222.   UBYTE xd_Second;    /* values 0 to 59         */
  223. };
  224.  
  225. #define XADDAY_MONDAY        1    /* monday is the first day and */
  226. #define XADDAY_TUESDAY        2
  227. #define XADDAY_WEDNESDAY    3
  228. #define XADDAY_THURSDAY        4
  229. #define XADDAY_FRIDAY        5
  230. #define XADDAY_SATURDAY     6
  231. #define XADDAY_SUNDAY        7    /* sunday the last day of a week */
  232.  
  233. struct xadDeviceInfo { /* for XAD_OUTDEVICE tag */
  234.   STRPTR xdi_DeviceName; /* name of device */
  235.   ULONG  xdi_Unit;     /* unit of device */
  236.   STRPTR xdi_DOSName;     /* instead of Device+Unit, dos name without ':' */
  237. };
  238.  
  239. struct xadSplitFile { /* for XAD_INSPLITTED */
  240.   struct xadSplitFile *xsf_Next;
  241.   ULONG               xsf_Type; /* XAD_INFILENAME, XAD_INFILEHANDLE, XAD_INMEMORY, XAD_INHOOK */
  242.   ULONG               xsf_Size; /* necessary for XAD_INMEMORY, useful for others */
  243.   ULONG               xsf_Data; /* FileName, Filehandle, Hookpointer or Memory */
  244. };
  245.  
  246. struct xadSkipInfo {
  247.   struct xadSkipInfo *xsi_Next;
  248.   ULONG              xsi_Position; /* position, where it should be skipped */
  249.   ULONG              xsi_SkipSize; /* size to skip */
  250. };
  251.  
  252. struct xadImageInfo { /* for XADHC_IMAGEINFO */
  253.   ULONG xii_SectorSize;   /* usually 512 */
  254.   ULONG xii_FirstSector;  /* of the image file */
  255.   ULONG xii_NumSectors;   /* of the image file */
  256.   ULONG xii_TotalSectors; /* of this device type */
  257. };
  258. /* If the image file holds total data of disk xii_TotalSectors equals
  259.    xii_NumSectors and xii_FirstSector is zero. Addition of xii_FirstSector
  260.    and xii_NumSectors cannot exceed xii_TotalSectors value!
  261. */
  262.  
  263. /************************************************************************
  264. *                                                *
  265. *    information structures                              *
  266. *                                                *
  267. ************************************************************************/
  268.  
  269. struct xadArchiveInfo {
  270.   struct xadClient *   xai_Client;   /* pointer to unarchiving client */
  271.   APTR               xai_PrivateClient; /* private client data */
  272.   STRPTR           xai_Password; /* password for crypted archives */
  273.   ULONG               xai_Flags;    /* read only XADAIF_ flags */
  274.   ULONG               xai_LowCyl;   /* lowest cylinder to unarchive */
  275.   ULONG               xai_HighCyl;  /* highest cylinder to unarchive */
  276.   ULONG               xai_InPos;    /* input position, read only */
  277.   ULONG               xai_InSize;   /* input size, read only */
  278.   ULONG               xai_OutPos;   /* output position, read only */
  279.   ULONG               xai_OutSize;  /* output file size, read only */
  280.   struct xadFileInfo * xai_FileInfo; /* data pointer for file arcs */
  281.   struct xadDiskInfo * xai_DiskInfo; /* data pointer for disk arcs */
  282.   struct xadFileInfo * xai_CurFile;  /* data pointer for current file arc */
  283.   struct xadDiskInfo * xai_CurDisk;  /* data pointer for current disk arc */
  284.   LONG               xai_LastError;   /* last error, when XADAIF_FILECORRUPT (V2) */
  285.   ULONG *           xai_MultiVolume; /* array of start offsets from parts (V2) */
  286.   struct xadSkipInfo * xai_SkipInfo;    /* linked list of skip entries (V3) */
  287.   struct xadImageInfo *xai_ImageInfo;   /* for filesystem clients (V5) */
  288.   STRPTR           xai_InName;   /* Input archive name if available (V7) */
  289. };
  290. /* This structure is nearly complete private to either xadmaster or its
  291. clients. An application program may access for reading only xai_Client,
  292. xai_Flags, xai_FileInfo and xai_DiskInfo. For xai_Flags only XADAIF_CRYPTED
  293. and XADAIF_FILECORRUPT are useful. All the other stuff is private and should
  294. not be accessed! */
  295.  
  296. #define XADAIB_CRYPTED         0 /* archive entries are encrypted */
  297. #define XADAIB_FILECORRUPT     1 /* file is corrupt, but valid entries are in the list */
  298. #define XADAIB_FILEARCHIVE     2 /* unarchive file entry */
  299. #define XADAIB_DISKARCHIVE     3 /* unarchive disk entry */
  300. #define XADAIB_OVERWRITE     4 /* overwrite the file (PRIVATE) */
  301. #define XADAIB_MAKEDIRECTORY     5 /* create directory when missing (PRIVATE) */
  302. #define XADAIB_IGNOREGEOMETRY     6 /* ignore drive geometry (PRIVATE) */
  303. #define XADAIB_VERIFY         7 /* verify is turned on for disk hook (PRIVATE) */
  304. #define XADAIB_NOKILLPARTIAL     8 /* do not delete partial files (PRIVATE) */
  305. #define XADAIB_DISKIMAGE     9 /* is disk image extraction (V5) */
  306. #define XADAIB_FORMAT        10 /* format in disk hook (PRIVATE) */
  307. #define XADAIB_NOEMPTYERROR    11 /* do not create empty error (PRIVATE) */
  308. #define XADAIB_ONLYIN        12 /* in stuff only (PRIVATE) */
  309. #define XADAIB_ONLYOUT        13 /* out stuff only (PRIVATE) */
  310. #define XADAIB_USESECTORLABELS    14 /* use SectorLabels (PRIVATE) */
  311.  
  312. #define XADAIF_CRYPTED        (1<<XADAIB_CRYPTED)
  313. #define XADAIF_FILECORRUPT    (1<<XADAIB_FILECORRUPT)
  314. #define XADAIF_FILEARCHIVE    (1<<XADAIB_FILEARCHIVE)
  315. #define XADAIF_DISKARCHIVE    (1<<XADAIB_DISKARCHIVE)
  316. #define XADAIF_OVERWRITE    (1<<XADAIB_OVERWRITE)
  317. #define XADAIF_MAKEDIRECTORY    (1<<XADAIB_MAKEDIRECTORY)
  318. #define XADAIF_IGNOREGEOMETRY    (1<<XADAIB_IGNOREGEOMETRY)
  319. #define XADAIF_VERIFY        (1<<XADAIB_VERIFY)
  320. #define XADAIF_NOKILLPARTIAL    (1<<XADAIB_NOKILLPARTIAL)
  321. #define XADAIF_DISKIMAGE    (1<<XADAIB_DISKIMAGE)
  322. #define XADAIF_FORMAT        (1<<XADAIB_FORMAT)
  323. #define XADAIF_NOEMPTYERROR    (1<<XADAIB_NOEMPTYERROR)
  324. #define XADAIF_ONLYIN        (1<<XADAIB_ONLYIN)
  325. #define XADAIF_ONLYOUT        (1<<XADAIB_ONLYOUT)
  326. #define XADAIF_USESECTORLABELS    (1<<XADAIB_USESECTORLABELS)
  327.  
  328. struct xadFileInfo {
  329.   struct xadFileInfo * xfi_Next;
  330.   ULONG               xfi_EntryNumber;/* number of entry, starts with 1 */
  331.   STRPTR           xfi_EntryInfo;  /* additional archiver text */
  332.   APTR               xfi_PrivateInfo;/* client private, see XAD_OBJPRIVINFOSIZE */
  333.   ULONG               xfi_Flags;      /* see XADFIF_xxx defines */
  334.   STRPTR           xfi_FileName;   /* see XAD_OBJNAMESIZE tag */
  335.   STRPTR           xfi_Comment;    /* see XAD_OBJCOMMENTSIZE tag */
  336.   ULONG             xfi_Protection; /* OS 3 bits (including multiuser) */
  337.   ULONG               xfi_OwnerUID;   /* user ID */
  338.   ULONG               xfi_OwnerGID;   /* group ID */
  339.   STRPTR           xfi_UserName;   /* user name */
  340.   STRPTR           xfi_GroupName;  /* group name */
  341.   ULONG                xfi_Size;       /* size of this file */
  342.   ULONG               xfi_GroupCrSize;/* crunched size of group */
  343.   ULONG               xfi_CrunchSize; /* crunched size */
  344.   STRPTR           xfi_LinkName;   /* name and path of link */
  345.   struct xadDate       xfi_Date;
  346.   UWORD               xfi_Generation; /* File Generation [0...0xFFFF] (V3) */
  347.   ULONG               xfi_DataPos;    /* crunched data position (V3) */
  348.   struct xadFileInfo * xfi_MacFork;    /* pointer to 2nd fork for Mac (V7) */
  349. };
  350.  
  351. /* Multiuser fields (xfi_OwnerUID, xfi_OwnerUID, xfi_UserName, xfi_GroupName)
  352.    and multiuser bits (see <dos/dos.h>) are currently not supported with normal
  353.    Amiga filesystem. But the clients support them, if archive format holds
  354.    such information.
  355. */
  356.  
  357. #define XADFIB_CRYPTED        0 /* entry is crypted */
  358. #define XADFIB_DIRECTORY    1 /* entry is a directory */
  359. #define XADFIB_LINK        2 /* entry is a link */
  360. #define XADFIB_INFOTEXT        3 /* file is an information text */
  361. #define XADFIB_GROUPED        4 /* file is in a crunch group */
  362. #define XADFIB_ENDOFGROUP    5 /* crunch group ends here */
  363. #define XADFIB_NODATE        6 /* no date supported, CURRENT date is set */
  364. #define XADFIB_DELETED        7 /* file is marked as deleted (V3) */
  365. #define XADFIB_SEEKDATAPOS    8 /* before unarchiving the datapos is set (V3) */
  366. #define XADFIB_NOFILENAME    9 /* there was no filename, using internal one (V6) */
  367. #define XADFIB_NOUNCRUNCHSIZE  10 /* file size is unknown and thus set to zero (V6) */
  368. #define XADFIB_PARTIALFILE     11 /* file is only partial (V6) */
  369. #define XADFIB_MACDATA           12 /* file is Apple data fork (V7) */
  370. #define XADFIB_MACRESOURCE     13 /* file is Apple resource fork (V7) */
  371. #define XADFIB_EXTRACTONBUILD  14 /* allows extract file during scanning (V10) */
  372.  
  373. #define XADFIF_CRYPTED        (1<<XADFIB_CRYPTED)
  374. #define XADFIF_DIRECTORY    (1<<XADFIB_DIRECTORY)
  375. #define XADFIF_LINK        (1<<XADFIB_LINK)
  376. #define XADFIF_INFOTEXT        (1<<XADFIB_INFOTEXT)
  377. #define XADFIF_GROUPED        (1<<XADFIB_GROUPED)
  378. #define XADFIF_ENDOFGROUP    (1<<XADFIB_ENDOFGROUP)
  379. #define XADFIF_NODATE        (1<<XADFIB_NODATE)
  380. #define XADFIF_DELETED        (1<<XADFIB_DELETED)
  381. #define XADFIF_SEEKDATAPOS    (1<<XADFIB_SEEKDATAPOS)
  382. #define XADFIF_NOFILENAME    (1<<XADFIB_NOFILENAME)
  383. #define XADFIF_NOUNCRUNCHSIZE    (1<<XADFIB_NOUNCRUNCHSIZE)
  384. #define XADFIF_PARTIALFILE    (1<<XADFIB_PARTIALFILE)
  385. #define XADFIF_MACDATA        (1<<XADFIB_MACDATA)
  386. #define XADFIF_MACRESOURCE    (1<<XADFIB_MACRESOURCE)
  387. #define XADFIF_EXTRACTONBUILD    (1<<XADFIB_EXTRACTONBUILD)
  388.  
  389. /* NOTE: the texts passed with that structure must not always be printable.
  390.    Although the clients should add an additional (not counted) zero at the text
  391.    end, the whole file may contain other unprintable stuff (e.g. for DMS).
  392.    So when printing this texts do it on a byte for byte base including
  393.    printability checks.
  394. */
  395. struct xadTextInfo {
  396.   struct xadTextInfo *    xti_Next;
  397.   ULONG            xti_Size;  /* maybe zero - no text - e.g. when crypted */
  398.   STRPTR        xti_Text;  /* and there is no password in xadGetInfo() */
  399.   ULONG            xti_Flags; /* see XADTIF_xxx defines */
  400. };
  401.  
  402. #define XADTIB_CRYPTED        0 /* entry is empty, as data was crypted */
  403. #define XADTIB_BANNER        1 /* text is a banner */
  404. #define XADTIB_FILEDIZ        2 /* text is a file description */
  405.  
  406. #define XADTIF_CRYPTED        (1<<XADTIB_CRYPTED)
  407. #define XADTIF_BANNER        (1<<XADTIB_BANNER)
  408. #define XADTIF_FILEDIZ        (1<<XADTIB_FILEDIZ)
  409.  
  410. struct xadDiskInfo {
  411.   struct xadDiskInfo *  xdi_Next;
  412.   ULONG                xdi_EntryNumber;  /* number of entry, starts with 1 */
  413.   STRPTR            xdi_EntryInfo;    /* additional archiver text */
  414.   APTR                xdi_PrivateInfo;  /* client private, see XAD_OBJPRIVINFOSIZE */
  415.   ULONG            xdi_Flags;      /* see XADDIF_xxx defines */
  416.   ULONG                xdi_SectorSize;
  417.   ULONG            xdi_TotalSectors; /* see devices/trackdisk.h */
  418.   ULONG                xdi_Cylinders;      /* to find out what these */
  419.   ULONG                xdi_CylSectors;      /* fields mean, they are equal */
  420.   ULONG                xdi_Heads;      /* to struct DriveGeometry */
  421.   ULONG            xdi_TrackSectors;
  422.   ULONG                xdi_LowCyl;       /* lowest cylinder stored */
  423.   ULONG                xdi_HighCyl;      /* highest cylinder stored */
  424.   ULONG            xdi_BlockInfoSize;/* number of BlockInfo entries */
  425.   UBYTE *        xdi_BlockInfo;    /* see XADBIF_xxx defines and XAD_OBJBLOCKENTRIES tag */
  426.   struct xadTextInfo *    xdi_TextInfo;      /* linked list with info texts */
  427.   ULONG                xdi_DataPos;      /* crunched data position (V3) */
  428. };
  429.  
  430. /* BlockInfo points to a UBYTE field for every track from first sector of
  431.    lowest cylinder to last sector of highest cylinder. When not used,
  432.    pointer must be 0. Do not use it, when there are no entries!
  433.    This is just for information. The applications still asks the client
  434.    to unarchive whole cylinders and not archived blocks are cleared for
  435.    unarchiving.
  436. */
  437.  
  438. #define XADDIB_CRYPTED          0 /* entry is crypted */
  439. #define XADDIB_SEEKDATAPOS      1 /* before unarchiving the datapos is set (V3) */
  440. #define XADDIB_SECTORLABELS      2 /* the clients delivers sector labels (V9) */
  441. #define XADDIB_EXTRACTONBUILD      3 /* allows extract disk during scanning (V10) */
  442.  
  443. /* Some of the crunchers do not store all necessary information, so it
  444. may be needed to guess some of them. Set the following flags in that case
  445. and geometry check will ignore these fields. */
  446. #define XADDIB_GUESSSECTORSIZE      5 /* sectorsize is guessed (V10) */
  447. #define XADDIB_GUESSTOTALSECTORS  6 /* totalsectors number is guessed (V10) */
  448. #define XADDIB_GUESSCYLINDERS      7 /* cylinder number is guessed */
  449. #define XADDIB_GUESSCYLSECTORS      8 /* cylsectors is guessed */
  450. #define XADDIB_GUESSHEADS      9 /* number of heads is guessed */
  451. #define XADDIB_GUESSTRACKSECTORS 10 /* tracksectors is guessed */
  452. #define XADDIB_GUESSLOWCYL     11 /* lowcyl is guessed */
  453. #define XADDIB_GUESSHIGHCYL     12 /* highcyl is guessed */
  454.  
  455. /* If it is impossible to set some of the fields, you need to set some of
  456. these flags. NOTE: XADDIB_NOCYLINDERS is really important, as this turns
  457. of usage of lowcyl and highcyl keywords. When you have cylinder information,
  458. you should not use these and instead use guess flags and calculate
  459. possible values for the missing fields. */
  460. #define XADDIB_NOCYLINDERS     15 /* cylinder number is not set */
  461. #define XADDIB_NOCYLSECTORS     16 /* cylsectors is not set */
  462. #define XADDIB_NOHEADS          17 /* number of heads is not set */
  463. #define XADDIB_NOTRACKSECTORS    18 /* tracksectors is not set */
  464. #define XADDIB_NOLOWCYL          19 /* lowcyl is not set */
  465. #define XADDIB_NOHIGHCYL     20 /* highcyl is not set */
  466.  
  467. #define XADDIF_CRYPTED         (1<<XADDIB_CRYPTED)
  468. #define XADDIF_SEEKDATAPOS     (1<<XADDIB_SEEKDATAPOS)
  469. #define XADDIF_SECTORLABELS     (1<<XADDIB_SECTORLABELS)
  470. #define XADDIF_EXTRACTONBUILD     (1<<XADDIB_EXTRACTONBUILD)
  471.  
  472. #define XADDIF_GUESSSECTORSIZE     (1<<XADDIB_GUESSSECTORSIZE)
  473. #define XADDIF_GUESSTOTALSECTORS (1<<XADDIB_GUESSTOTALSECTORS)
  474. #define XADDIF_GUESSCYLINDERS     (1<<XADDIB_GUESSCYLINDERS)
  475. #define XADDIF_GUESSCYLSECTORS     (1<<XADDIB_GUESSCYLSECTORS)
  476. #define XADDIF_GUESSHEADS     (1<<XADDIB_GUESSHEADS)
  477. #define XADDIF_GUESSTRACKSECTORS (1<<XADDIB_GUESSTRACKSECTORS)
  478. #define XADDIF_GUESSLOWCYL     (1<<XADDIB_GUESSLOWCYL)
  479. #define XADDIF_GUESSHIGHCYL     (1<<XADDIB_GUESSHIGHCYL)
  480.  
  481. #define XADDIF_NOCYLINDERS     (1<<XADDIB_NOCYLINDERS)
  482. #define XADDIF_NOCYLSECTORS     (1<<XADDIB_NOCYLSECTORS)
  483. #define XADDIF_NOHEADS         (1<<XADDIB_NOHEADS)
  484. #define XADDIF_NOTRACKSECTORS     (1<<XADDIB_NOTRACKSECTORS)
  485. #define XADDIF_NOLOWCYL         (1<<XADDIB_NOLOWCYL)
  486. #define XADDIF_NOHIGHCYL     (1<<XADDIB_NOHIGHCYL)
  487.  
  488. /* defines for BlockInfo */
  489. #define XADBIB_CLEARED        0 /* this block was cleared for archiving */
  490. #define XADBIB_UNUSED        1 /* this block was not archived */
  491.  
  492. #define XADBIF_CLEARED        (1<<XADBIB_CLEARED)
  493. #define XADBIF_UNUSED        (1<<XADBIB_UNUSED)
  494.  
  495. /************************************************************************
  496. *                                                *
  497. *    progress report stuff                              *
  498. *                                                *
  499. ************************************************************************/
  500.  
  501. struct xadProgressInfo {
  502.   ULONG            xpi_Mode;    /* work modus */
  503.   struct xadClient *    xpi_Client;    /* the client doing the work */
  504.   struct xadDiskInfo *    xpi_DiskInfo;    /* current diskinfo, for disks */
  505.   struct xadFileInfo *    xpi_FileInfo;    /* current info for files */
  506.   ULONG            xpi_CurrentSize;/* current filesize */
  507.   ULONG            xpi_LowCyl;    /* for disks only */
  508.   ULONG            xpi_HighCyl;    /* for disks only */
  509.   ULONG            xpi_Status;    /* see XADPIF flags */
  510.   LONG            xpi_Error;    /* any of the error codes */
  511.   STRPTR        xpi_FileName;    /* name of file to overwrite (V2) */
  512.   STRPTR        xpi_NewName;    /* new name buffer, passed by hook (V2) */
  513. };
  514. /* NOTE: For disks CurrentSize is Sector*SectorSize, where SectorSize can
  515. be found in xadDiskInfo structure. So you may output the sector value. */
  516.  
  517. /* different progress modes */
  518. #define XADPMODE_ASK        1
  519. #define XADPMODE_PROGRESS    2
  520. #define XADPMODE_END        3
  521. #define XADPMODE_ERROR        4
  522. #define XADPMODE_NEWENTRY       5 /* (V10) */
  523.  
  524. /* flags for progress hook and ProgressInfo status field */
  525. #define XADPIB_OVERWRITE     0 /* overwrite the file */
  526. #define XADPIB_MAKEDIRECTORY     1 /* create the directory */
  527. #define XADPIB_IGNOREGEOMETRY     2 /* ignore drive geometry */
  528. #define XADPIB_ISDIRECTORY     3 /* destination is a directory (V10) */
  529. #define XADPIB_RENAME        10 /* rename the file (V2) */
  530. #define XADPIB_OK        16 /* all ok, proceed */
  531. #define XADPIB_SKIP        17 /* skip file */
  532.  
  533. #define XADPIF_OVERWRITE    (1<<XADPIB_OVERWRITE)
  534. #define XADPIF_MAKEDIRECTORY    (1<<XADPIB_MAKEDIRECTORY)
  535. #define XADPIF_IGNOREGEOMETRY    (1<<XADPIB_IGNOREGEOMETRY)
  536. #define XADPIF_ISDIRECTORY    (1<<XADPIB_ISDIRECTORY)
  537. #define XADPIF_RENAME        (1<<XADPIB_RENAME)
  538. #define XADPIF_OK        (1<<XADPIB_OK)
  539. #define XADPIF_SKIP        (1<<XADPIB_SKIP)
  540.  
  541. /************************************************************************
  542. *                                                *
  543. *    errors                                       *
  544. *                                                *
  545. ************************************************************************/
  546.  
  547. #define XADERR_OK        0x0000 /* no error */
  548. #define XADERR_UNKNOWN        0x0001 /* unknown error */
  549. #define XADERR_INPUT        0x0002 /* input data buffers border exceeded */
  550. #define XADERR_OUTPUT        0x0003 /* output data buffers border exceeded */
  551. #define XADERR_BADPARAMS    0x0004 /* function called with illegal parameters */
  552. #define XADERR_NOMEMORY        0x0005 /* not enough memory available */
  553. #define XADERR_ILLEGALDATA    0x0006 /* data is corrupted */
  554. #define XADERR_NOTSUPPORTED    0x0007 /* command is not supported */
  555. #define XADERR_RESOURCE        0x0008 /* required resource missing */
  556. #define XADERR_DECRUNCH        0x0009 /* error on decrunching */
  557. #define XADERR_FILETYPE        0x000A /* unknown file type */
  558. #define XADERR_OPENFILE        0x000B /* opening file failed */
  559. #define XADERR_SKIP        0x000C /* file, disk has been skipped */
  560. #define XADERR_BREAK        0x000D /* user break in progress hook */
  561. #define XADERR_FILEEXISTS    0x000E /* file already exists */
  562. #define XADERR_PASSWORD        0x000F /* missing or wrong password */
  563. #define XADERR_MAKEDIR        0x0010 /* could not create directory */
  564. #define XADERR_CHECKSUM        0x0011 /* wrong checksum */
  565. #define XADERR_VERIFY        0x0012 /* verify failed (disk hook) */
  566. #define XADERR_GEOMETRY        0x0013 /* wrong drive geometry */
  567. #define XADERR_DATAFORMAT    0x0014 /* unknown data format */
  568. #define XADERR_EMPTY        0x0015 /* source contains no files */
  569. #define XADERR_FILESYSTEM    0x0016 /* unknown filesystem */
  570. #define XADERR_FILEDIR        0x0017 /* name of file exists as directory */
  571.  
  572. /************************************************************************
  573. *                                                *
  574. *    client related stuff                           *
  575. *                                                *
  576. ************************************************************************/
  577.  
  578. struct xadForeman {
  579.   ULONG             xfm_Security;    /* should be XADFOREMAN_SECURITY */
  580.   ULONG             xfm_ID;          /* must be XADFOREMAN_ID */
  581.   UWORD             xfm_Version;     /* set to XADFOREMAN_VERSION */
  582.   UWORD             xfm_Reserved;
  583.   STRPTR         xfm_VersString;  /* pointer to $VER: string */
  584.   struct xadClient * xfm_FirstClient; /* pointer to first client */
  585. };
  586.  
  587. #define XADFOREMAN_SECURITY    0x70FF4E75 /* MOVEQ #-1,D0 and RTS */
  588. #define XADFOREMAN_ID        0x58414446 /* 'XADF' identification ID */
  589. #define XADFOREMAN_VERSION    1
  590.  
  591. struct xadClient {
  592.   struct xadClient * xc_Next;
  593.   UWORD             xc_Version;    /* set to XADCLIENT_VERSION */
  594.   UWORD             xc_MasterVersion;
  595.   UWORD             xc_ClientVersion;
  596.   UWORD             xc_ClientRevision;
  597.   ULONG             xc_RecogSize;  /* needed size to recog the type */
  598.   ULONG             xc_Flags;      /* see XADCF_xxx defines */
  599.   ULONG             xc_Identifier; /* ID of internal clients */
  600.   STRPTR         xc_ArchiverName;
  601.   BOOL          (* xc_RecogData)();
  602.   LONG          (* xc_GetInfo)();
  603.   LONG          (* xc_UnArchive)();
  604.   void          (* xc_Free)();
  605. };
  606.  
  607. /* function interface
  608. ASM(BOOL) xc_RecogData(REG(d0, ULONG size), REG(a0, STRPTR data),
  609.         REG(a6, struct xadMasterBase *xadMasterBase));
  610. ASM(LONG) xc_GetInfo(REG(a0, struct xadArchiveInfo *ai),
  611.         REG(a6, struct xadMasterBase *xadMasterBase));
  612. ASM(LONG) xc_UnArchive(REG(a0, struct xadArchiveInfo *ai),
  613.         REG(a6, struct xadMasterBase *xadMasterBase));
  614. ASM(void) xc_Free(REG(a0, struct xadArchiveInfo *ai),
  615.         REG(a6, struct xadMasterBase *xadMasterBase));
  616. */
  617.  
  618. /* xc_RecogData returns 1 when recognized and 0 when not, all the others
  619.    return 0 when ok and XADERR values on error. xc_Free has no return
  620.    value.
  621.  
  622.    Filesystem clients need to clear xc_RecogSize and xc_RecogData. The
  623.    recognition is automatically done by GetInfo. XADERR_FILESYSTEM is
  624.    returned in case of unknown format. If it is known detection should
  625.    go on and any other code may be returned, if it fails.
  626.    The field xc_ArchiverName means xc_FileSystemName for filesystem
  627.    clients.
  628. */
  629.  
  630. #define XADCLIENT_VERSION    1
  631.  
  632. #define XADCB_FILEARCHIVER     0 /* archiver is a file archiver */
  633. #define XADCB_DISKARCHIVER     1 /* archiver is a disk archiver */
  634. #define XADCB_EXTERN         2 /* external client, set by xadmaster */
  635. #define XADCB_FILESYSTEM     3 /* filesystem clients (V5) */
  636. #define XADCB_NOCHECKSIZE     4 /* do not check size for recog call (V6) */
  637. #define XADCB_FREESKIPINFO    27 /* master frees xadSkipInfo structures (V3) */
  638. #define XADCB_FREETEXTINFO    28 /* master frees xadTextInfo structures (V2) */
  639. #define XADCB_FREETEXTINFOTEXT    29 /* master frees xadTextInfo text block (V2) */
  640. #define XADCB_FREEFILEINFO    30 /* master frees xadFileInfo structures (V2) */
  641. #define XADCB_FREEDISKINFO    31 /* master frees xadDiskInfo structures (V2) */
  642.  
  643. #define XADCF_FILEARCHIVER    (1<<XADCB_FILEARCHIVER)
  644. #define XADCF_DISKARCHIVER    (1<<XADCB_DISKARCHIVER)
  645. #define XADCF_EXTERN        (1<<XADCB_EXTERN)
  646. #define XADCF_FILESYSTEM    (1<<XADCB_FILESYSTEM)
  647. #define XADCF_NOCHECKSIZE    (1<<XADCB_NOCHECKSIZE)
  648. #define XADCF_FREESKIPINFO    (1<<XADCB_FREESKIPINFO)
  649. #define XADCF_FREETEXTINFO    (1<<XADCB_FREETEXTINFO)
  650. #define XADCF_FREETEXTINFOTEXT    (1<<XADCB_FREETEXTINFOTEXT)
  651. #define XADCF_FREEFILEINFO    (1<<XADCB_FREEFILEINFO)
  652. #define XADCF_FREEDISKINFO    (1<<XADCB_FREEDISKINFO)
  653.  
  654. /************************************************************************
  655. *                                                *
  656. *    client ID's                                   *
  657. *                                                *
  658. ************************************************************************/
  659.  
  660. /* If an external client has set the xc_Identifier field, the internal
  661. client is replaced. */
  662.  
  663. /* disk archivers start with 1000 */
  664. #define XADCID_XMASH            1000
  665. #define XADCID_SUPERDUPER3        1001
  666. #define XADCID_XDISK            1002
  667. #define XADCID_PACKDEV            1003
  668. #define XADCID_ZOOM            1004
  669. #define XADCID_ZOOM5            1005
  670. #define XADCID_CRUNCHDISK        1006
  671. #define XADCID_PACKDISK            1007
  672. #define XADCID_MDC            1008
  673. #define XADCID_COMPDISK            1009
  674. #define XADCID_LHWARP            1010
  675. #define XADCID_SAVAGECOMPRESSOR        1011
  676. #define XADCID_WARP            1012
  677. #define XADCID_GDC            1013
  678.  
  679. /* file archivers start with 5000 */
  680. #define XADCID_TAR            5000
  681. #define XADCID_SDSSFX            5001
  682. #define XADCID_LZX            5002
  683. #define XADCID_MXMSIMPLEARC        5003
  684. #define XADCID_LHPAK            5004
  685. #define XADCID_AMIGAPLUSUNPACK        5005
  686. #define XADCID_AMIPACK            5006
  687. #define XADCID_LHA            5007
  688. #define XADCID_LHASFX            5008
  689. #define XADCID_PCOMPARC            5009
  690. #define XADCID_SOMNI            5010
  691. #define XADCID_LHSFX            5011
  692. #define XADCID_XPKARCHIVE        5012
  693. #define XADCID_SHRINK            5013
  694. #define XADCID_SPACK            5014
  695. #define XADCID_SPACKSFX            5015
  696. #define XADCID_ZIP            5016
  697. #define XADCID_WINZIPEXE        5017
  698. #define XADCID_GZIP            5018
  699. #define XADCID_ARC            5019
  700. #define XADCID_ZOO            5020
  701. #define XADCID_LHAEXE            5021
  702. #define XADCID_ARJ            5022
  703. #define XADCID_ARJEXE            5023
  704. #define XADCID_ZIPEXE            5024
  705. #define XADCID_LHF            5025
  706. #define XADCID_COMPRESS            5026
  707. #define XADCID_ACE            5027
  708. #define XADCID_ACEEXE            5028
  709. #define XADCID_GZIPSFX            5029
  710. #define XADCID_HA            5030
  711. #define XADCID_SQ            5031
  712. #define XADCID_LHAC64SFX        5032
  713.  
  714. /* filesystem client start with 8000 */
  715.  
  716. #define XADCID_FSAMIGA            8000
  717. #define XADCID_FSSANITYOS        8001
  718. #define XADCID_FSFAT            8002
  719.  
  720. /* mixed archivers start with 9000 */
  721. #define XADCID_DMS            9000
  722. #define XADCID_DMSSFX            9001
  723.  
  724. #endif /* LIBRARIES_XADMASTER_H */
  725.